<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>结构性伪类选择器 nth-child(n)</title>
    <style>
    /* :nth-child(n) 第几个子元素 
       奇偶行变色   2n+1 = odd 奇数   2n = even 偶数
    */
    ol li:nth-child(2n+1){
        background-color: red;
    }
    ol li:nth-child(2n){
        background-color: green;
    }
    ol li:hover{
        background-color: pink;
    }
    </style>
</head>

<body>
    <ol>
        <li>item1</li>
        <li>item2</li>
        <li>item3</li>
        <li>item4</li>
        <li>item5</li>
        <li>item6</li>
        <li>item7</li>
        <li>item8</li>
        <li>item9</li>
        <li>item10</li>
    </ol>​
</body>

</html>